package meconsea.life.cms.web.tags;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;

import org.apache.log4j.Logger;
import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;

import com.opensymphony.xwork2.util.ValueStack;

public class ArtClsListTag extends ComponentTagSupport {

	private static final long serialVersionUID = -1827978135193591801L;
	private static final Logger log = Logger.getLogger(ArtClsListTag.class);
	
	protected String statusAttr;
	private String clsList;

	public String getClsList() {
		return clsList;
	}
	public void setClsList(String clsList) {
		this.clsList = clsList;
	}
	//通用
	protected void populateParams() {
		super.populateParams();
		ArtClsList tag = (ArtClsList) getComponent();
		tag.setStatus(statusAttr);
		//业务属性 
		tag.setClsList(clsList);
	}
	public Component getBean(ValueStack stack, HttpServletRequest req,
			HttpServletResponse res) {
		return new ArtClsList(stack, req, res, this.pageContext);
	}
	public void setStatus(String status) {
		this.statusAttr = status;
	}

	public String getStatusAttr() {
		return statusAttr;
	}

	public void setStatusAttr(String statusAttr) {
		this.statusAttr = statusAttr;
	}

	public int doEndTag() throws JspException {
		component = null;
		return EVAL_PAGE;
	}

	public int doAfterBody() throws JspException {
		boolean again = component.end(pageContext.getOut(), getBody());

		if (again) {
			return EVAL_BODY_AGAIN;
		} else {
			if (bodyContent != null) {
				try {
					bodyContent.writeOut(bodyContent.getEnclosingWriter());
				} catch (Exception e) {
					throw new JspException(e.getMessage());
				}
			}
			return SKIP_BODY;
		}
	}

}
